package com.esri.core.tasks.na;

import com.esri.core.map.Graphic;
import java.util.ArrayList;
import java.util.List;

/* loaded from: classes.dex */
class SolveCondition {
    private static final String default_message = "Network Analyst Error";
    private static final String directions_and_time_attribute_mismatch = "Directions and time attribute mismatch";
    private static final String insufficient_number_of_stops = "Insufficient number of stops";
    private static final String invalid_accumulate_attrubte = "%s is an invalid accumulate attribute";
    private static final String invalid_attribute_parameters_attribute_name = "%s is an invalid attribute parameter value attribute name";
    private static final String invalid_attribute_parameters_parameter_value = "%s is an invalid attribute parameter value parameter value";
    private static final String invalid_attribute_parameters_restrictions_usage_value = "%s is an invalid attribute parameter restrictions usage value";
    private static final String invalid_attribute_parameters_value_type = "%s is an invalid attribute parameter value type";
    private static final String invalid_directions_distance_attribute = "%s is an invalid directions distance attribute";
    private static final String invalid_directions_language = "Invalid directions language";
    private static final String invalid_directions_road_class_attribute = "Invalid directions road class attribute";
    private static final String invalid_directions_style = "Invalid directions style";
    private static final String invalid_directions_time_attribute = "%s is an invalid directions time attribute";
    private static final String invalid_impedance_attribute = "%s is an invalid impedance attribute";
    private static final String invalid_restrictions_attribute = "%s is an invalid restriction attribute";
    private static final String line_barrier_does_not_cover_any_network_elements = "Line barrier at index %d does not cover any network elements";
    private static final String line_barrier_invalid_scaled_cost_attribute_name = "Line barrier at index %d has an invalid scaled cost attribute name";
    private static final String network_has_no_hierarchy_attribute = "Network has no hierarchy attribute";
    private static final String neutral_attribute_parameters_restrictions_usage_value = "%s is a neutral attribute parameter restrictions usage value";
    private static final String no_path_found_between_stops = "No path was found between the stops";
    private static final String point_barrier_invalid_added_cost_attribute_name = "Point barrier at index %d has an invalid added cost attribute name";
    private static final String point_barrier_unlocated = "Point barrier at index %d was not located";
    private static final String polygon_barrier_does_not_cover_any_network_elements = "Polygon barrier at index %d does not cover any network elements";
    private static final String polygon_barrier_invalid_scaled_cost_attribute_name = "Polygon barrier at index %d has an invalid scaled cost attribute name";
    private static final String route_local_start_time_before_unix_epoch = "Route local start time is before the Unix epoch";
    private static final String route_utc_start_time_at_stop_before_unix_epoch = "%s has a UTC start time before the Unix epoch";
    private static final String stop_local_time_window_start_before_unix_epoch = "%s has a local start time before the Unix epoch";
    private static final String stop_located_on_non_traversable_element = "%s is located on a non traversable element";
    private static final String stop_located_on_soft_restricted_element = "%s is located on a soft restricted element";
    private static final String stop_time_window_is_inverted = "%s has an inverted time window";
    private static final String stop_unlocated = "%s was not located";
    private static final String stop_utc_time_window_start_before_unix_epoch = "%s has a time window start before the Unix epoch";
    private static final String traversed_soft_restricted_elements = "Elements with soft restriction: %s were traversed";
    private static final String undefined_input_spatial_reference = "Undefined input spatial reference";
    private static final String undefined_output_spatial_reference = "Undefined output spatial reference";
    private static final String unnamed_stop = "Stop at index %d";
    private SolveCode mCode;
    private int[] mDetails = null;

    SolveCondition(int i) {
        this.mCode = null;
        this.mCode = SolveCode.fromInteger(i);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public SolveCondition(SolveCode solveCode) {
        this.mCode = null;
        this.mCode = solveCode;
    }

    void setDetails(int[] iArr) {
        this.mDetails = iArr;
    }

    public int[] getDetails() {
        return this.mDetails;
    }

    public SolveCode getCode() {
        return this.mCode;
    }

    private String getStopRelatedMessage(String str, int i, RouteParameters routeParameters) {
        List<Graphic> features = ((NAFeaturesAsFeature) routeParameters.getStops()).getFeatures();
        if (i < 0 || i >= features.size()) {
            return str;
        }
        String str2 = (String) features.get(i).getAttributeValue("Name");
        Object[] objArr = new Object[1];
        if (str2 == null) {
            str2 = String.format(unnamed_stop, Integer.valueOf(i));
        }
        objArr[0] = str2;
        return String.format(str, objArr);
    }

    public String[] getMessagesForCondition(RouteParameters routeParameters) {
        int[] iArr;
        int[] iArr2;
        int[] iArr3;
        int[] iArr4;
        int[] iArr5;
        int[] iArr6;
        int[] iArr7;
        int[] iArr8;
        if (this.mCode == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        int i = 0;
        switch (AnonymousClass1.$SwitchMap$com$esri$core$tasks$na$SolveCode[this.mCode.ordinal()]) {
            case 1:
                arrayList.add(insufficient_number_of_stops);
                break;
            case 2:
                int[] iArr9 = this.mDetails;
                int length = iArr9.length;
                while (i < length) {
                    arrayList.add(getStopRelatedMessage(stop_unlocated, iArr9[i], routeParameters));
                    i++;
                }
                break;
            case 3:
                int[] iArr10 = this.mDetails;
                int length2 = iArr10.length;
                while (i < length2) {
                    arrayList.add(getStopRelatedMessage(stop_located_on_non_traversable_element, iArr10[i], routeParameters));
                    i++;
                }
                break;
            case 4:
                int[] iArr11 = this.mDetails;
                int length3 = iArr11.length;
                while (i < length3) {
                    arrayList.add(getStopRelatedMessage(stop_located_on_soft_restricted_element, iArr11[i], routeParameters));
                    i++;
                }
                break;
            case 5:
                int[] iArr12 = this.mDetails;
                int length4 = iArr12.length;
                for (int i2 = 0; i2 < length4; i2++) {
                    arrayList.add(String.format(point_barrier_unlocated, Integer.valueOf(iArr12[i2])));
                }
                break;
            case 6:
                int[] iArr13 = this.mDetails;
                int length5 = iArr13.length;
                for (int i3 = 0; i3 < length5; i3++) {
                    arrayList.add(String.format(point_barrier_invalid_added_cost_attribute_name, Integer.valueOf(iArr13[i3])));
                }
                break;
            case 7:
                int[] iArr14 = this.mDetails;
                int length6 = iArr14.length;
                for (int i4 = 0; i4 < length6; i4++) {
                    arrayList.add(String.format(line_barrier_invalid_scaled_cost_attribute_name, Integer.valueOf(iArr14[i4])));
                }
                break;
            case 8:
                int[] iArr15 = this.mDetails;
                int length7 = iArr15.length;
                for (int i5 = 0; i5 < length7; i5++) {
                    arrayList.add(String.format(line_barrier_does_not_cover_any_network_elements, Integer.valueOf(iArr15[i5])));
                }
                break;
            case 9:
                int[] iArr16 = this.mDetails;
                int length8 = iArr16.length;
                for (int i6 = 0; i6 < length8; i6++) {
                    arrayList.add(String.format(polygon_barrier_invalid_scaled_cost_attribute_name, Integer.valueOf(iArr16[i6])));
                }
                break;
            case 10:
                int[] iArr17 = this.mDetails;
                int length9 = iArr17.length;
                for (int i7 = 0; i7 < length9; i7++) {
                    arrayList.add(String.format(polygon_barrier_does_not_cover_any_network_elements, Integer.valueOf(iArr17[i7])));
                }
                break;
            case 11:
                arrayList.add(String.format(invalid_impedance_attribute, routeParameters.getImpedanceAttributeName()));
                break;
            case 12:
                String[] restrictionAttributeNames = routeParameters.getRestrictionAttributeNames();
                if (restrictionAttributeNames != null && (iArr = this.mDetails) != null) {
                    int length10 = iArr.length;
                    for (int i8 = 0; i8 < length10; i8++) {
                        arrayList.add(String.format(invalid_restrictions_attribute, restrictionAttributeNames[iArr[i8]]));
                    }
                    break;
                }
                break;
            case 13:
                String[] accumulateAttributeNames = routeParameters.getAccumulateAttributeNames();
                if (accumulateAttributeNames != null && (iArr2 = this.mDetails) != null) {
                    int length11 = iArr2.length;
                    for (int i9 = 0; i9 < length11; i9++) {
                        arrayList.add(String.format(invalid_accumulate_attrubte, accumulateAttributeNames[iArr2[i9]]));
                    }
                    break;
                }
                break;
            case 14:
                arrayList.add(String.format(invalid_directions_time_attribute, routeParameters.getImpedanceAttributeName()));
                break;
            case 15:
                arrayList.add(String.format(invalid_directions_distance_attribute, routeParameters.getDirectionsLengthUnit().name()));
                break;
            case 16:
                AttributeParameterValue[] attributeParameterValues = routeParameters.getAttributeParameterValues();
                if (attributeParameterValues != null && (iArr3 = this.mDetails) != null) {
                    int length12 = iArr3.length;
                    for (int i10 = 0; i10 < length12; i10++) {
                        arrayList.add(String.format(invalid_attribute_parameters_attribute_name, attributeParameterValues[iArr3[i10]].getAttributeName()));
                    }
                    break;
                }
                break;
            case 17:
                AttributeParameterValue[] attributeParameterValues2 = routeParameters.getAttributeParameterValues();
                if (attributeParameterValues2 != null && (iArr4 = this.mDetails) != null) {
                    int length13 = iArr4.length;
                    for (int i11 = 0; i11 < length13; i11++) {
                        arrayList.add(String.format(invalid_attribute_parameters_parameter_value, attributeParameterValues2[iArr4[i11]].getParameterName()));
                    }
                    break;
                }
                break;
            case 18:
                AttributeParameterValue[] attributeParameterValues3 = routeParameters.getAttributeParameterValues();
                if (attributeParameterValues3 != null && (iArr5 = this.mDetails) != null) {
                    int length14 = iArr5.length;
                    for (int i12 = 0; i12 < length14; i12++) {
                        arrayList.add(String.format(invalid_attribute_parameters_value_type, attributeParameterValues3[iArr5[i12]].getValue()));
                    }
                    break;
                }
                break;
            case 19:
                AttributeParameterValue[] attributeParameterValues4 = routeParameters.getAttributeParameterValues();
                if (attributeParameterValues4 != null && (iArr6 = this.mDetails) != null) {
                    int length15 = iArr6.length;
                    for (int i13 = 0; i13 < length15; i13++) {
                        arrayList.add(String.format(invalid_attribute_parameters_restrictions_usage_value, attributeParameterValues4[iArr6[i13]].getValue()));
                    }
                    break;
                }
                break;
            case 20:
                AttributeParameterValue[] attributeParameterValues5 = routeParameters.getAttributeParameterValues();
                if (attributeParameterValues5 != null && (iArr7 = this.mDetails) != null) {
                    int length16 = iArr7.length;
                    for (int i14 = 0; i14 < length16; i14++) {
                        arrayList.add(String.format(neutral_attribute_parameters_restrictions_usage_value, attributeParameterValues5[iArr7[i14]].getValue()));
                    }
                    break;
                }
                break;
            case 21:
                String[] restrictionAttributeNames2 = routeParameters.getRestrictionAttributeNames();
                if (restrictionAttributeNames2 != null && (iArr8 = this.mDetails) != null) {
                    int length17 = iArr8.length;
                    for (int i15 = 0; i15 < length17; i15++) {
                        arrayList.add(String.format(traversed_soft_restricted_elements, restrictionAttributeNames2[iArr8[i15]]));
                    }
                    break;
                }
                break;
            case 22:
                arrayList.add(network_has_no_hierarchy_attribute);
                break;
            case 23:
                arrayList.add(no_path_found_between_stops);
                break;
            case 24:
                arrayList.add(undefined_input_spatial_reference);
                break;
            case 25:
                arrayList.add(undefined_output_spatial_reference);
                break;
            case 26:
                arrayList.add(invalid_directions_style);
                break;
            case 27:
                arrayList.add(invalid_directions_language);
                break;
            case 28:
                arrayList.add(directions_and_time_attribute_mismatch);
                break;
            case 29:
                arrayList.add(invalid_directions_road_class_attribute);
                break;
            case 30:
                arrayList.add(route_local_start_time_before_unix_epoch);
                break;
            case 31:
                int[] iArr18 = this.mDetails;
                int length18 = iArr18.length;
                while (i < length18) {
                    arrayList.add(getStopRelatedMessage(route_utc_start_time_at_stop_before_unix_epoch, iArr18[i], routeParameters));
                    i++;
                }
                break;
            case 32:
                int[] iArr19 = this.mDetails;
                int length19 = iArr19.length;
                while (i < length19) {
                    arrayList.add(getStopRelatedMessage(stop_local_time_window_start_before_unix_epoch, iArr19[i], routeParameters));
                    i++;
                }
                break;
            case 33:
                int[] iArr20 = this.mDetails;
                int length20 = iArr20.length;
                while (i < length20) {
                    arrayList.add(getStopRelatedMessage(stop_utc_time_window_start_before_unix_epoch, iArr20[i], routeParameters));
                    i++;
                }
                break;
            case 34:
                int[] iArr21 = this.mDetails;
                int length21 = iArr21.length;
                while (i < length21) {
                    arrayList.add(getStopRelatedMessage(stop_time_window_is_inverted, iArr21[i], routeParameters));
                    i++;
                }
                break;
            default:
                arrayList.add(default_message);
                break;
        }
        return (String[]) arrayList.toArray(new String[arrayList.size()]);
    }

    /* renamed from: com.esri.core.tasks.na.SolveCondition$1  reason: invalid class name */
    /* loaded from: classes.dex */
    static /* synthetic */ class AnonymousClass1 {
        static final /* synthetic */ int[] $SwitchMap$com$esri$core$tasks$na$SolveCode;

        static {
            int[] iArr = new int[SolveCode.values().length];
            $SwitchMap$com$esri$core$tasks$na$SolveCode = iArr;
            try {
                iArr[SolveCode.INSUFFICIENT_NUMBER_OF_STOPS.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.STOP_UNLOCATED.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.STOP_LOCATED_ON_NON_TRAVERSABLE_ELEMENT.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.STOP_LOCATED_ON_SOFT_RESTRICTED_ELEMENT.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.POINT_BARRIER_UNLOCATED.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.POINT_BARRIER_INVALID_ADDED_COST_ATTRIBUTE_NAME.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.LINE_BARRIER_INVALID_SCALED_COST_ATTRIBUTE_NAME.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.LINE_BARRIER_DOES_NOT_COVER_ANY_NETWORK_ELEMENTS.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.POLYGON_BARRIER_INVALID_SCALED_COST_ATTRIBUTE_NAME.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.POLYGON_BARRIER_DOES_NOT_COVER_ANY_NETWORK_ELEMENTS.ordinal()] = 10;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_IMPEDANCE_ATTRIBUTE.ordinal()] = 11;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_RESTRICTION_ATTRIBUTE.ordinal()] = 12;
            } catch (NoSuchFieldError unused12) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_ACCUMULATE_ATTRIBUTE.ordinal()] = 13;
            } catch (NoSuchFieldError unused13) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_DIRECTIONS_TIME_ATTRIBUTE.ordinal()] = 14;
            } catch (NoSuchFieldError unused14) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_DIRECTIONS_DISTANCE_ATTRIBUTE.ordinal()] = 15;
            } catch (NoSuchFieldError unused15) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_ATTRIBUTE_PARAMETERS_ATTRIBUTE_NAME.ordinal()] = 16;
            } catch (NoSuchFieldError unused16) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_ATRRIBUTE_PARAMETERS_PARAMETER_NAME.ordinal()] = 17;
            } catch (NoSuchFieldError unused17) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_ATTRIBUTE_PARAMETERS_VALUE_TYPE.ordinal()] = 18;
            } catch (NoSuchFieldError unused18) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_ATTRIBUTE_PARAMETERS_RESTRICTION_USAGE_VALUE.ordinal()] = 19;
            } catch (NoSuchFieldError unused19) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.NEUTRAL_ATTRIBUTE_PARAMETERS_RESTRICTION_USAGE_VALUE.ordinal()] = 20;
            } catch (NoSuchFieldError unused20) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.TRAVERSED_SOFT_RESTRICTED_ELEMENTS.ordinal()] = 21;
            } catch (NoSuchFieldError unused21) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.NETWORK_HAS_NO_HIERARCHY_ATTRIBUTES.ordinal()] = 22;
            } catch (NoSuchFieldError unused22) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.NO_PATH_FOUND_BETWEEN_STOPS.ordinal()] = 23;
            } catch (NoSuchFieldError unused23) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.UNDEFINED_INPUT_SPATIAL_REFERENCE.ordinal()] = 24;
            } catch (NoSuchFieldError unused24) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.UNDEFINED_OUTPUT_SPATIAL_REFERENCE.ordinal()] = 25;
            } catch (NoSuchFieldError unused25) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_DIRECTIONS_STYLE.ordinal()] = 26;
            } catch (NoSuchFieldError unused26) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_DIRECTIONS_LANGUAGE.ordinal()] = 27;
            } catch (NoSuchFieldError unused27) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.DIRECTIONS_TIME_AND_IMPEDANCE_ATTRIBUTE_MISMATCH.ordinal()] = 28;
            } catch (NoSuchFieldError unused28) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.INVALID_DIRECTIONS_ROAD_CLASS_ATTRIBUTE.ordinal()] = 29;
            } catch (NoSuchFieldError unused29) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.ROUTE_LOCAL_START_TIME_BEFORE_UNIX_EPOCH.ordinal()] = 30;
            } catch (NoSuchFieldError unused30) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.ROUTE_UTC_START_TIME_AT_STOP_BEFORE_UNIX_EPOCH.ordinal()] = 31;
            } catch (NoSuchFieldError unused31) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.STOP_LOCAL_TIME_WINDOW_STARTS_BEFORE_UNIX_EPOCH.ordinal()] = 32;
            } catch (NoSuchFieldError unused32) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.STOP_UTC_TIME_WINDOW_STARTS_BEFORE_UNIX_EPOCH.ordinal()] = 33;
            } catch (NoSuchFieldError unused33) {
            }
            try {
                $SwitchMap$com$esri$core$tasks$na$SolveCode[SolveCode.STOP_TIME_WINDOW_IS_INVERTED.ordinal()] = 34;
            } catch (NoSuchFieldError unused34) {
            }
        }
    }
}
